Initial Power Measurement Data Analysis¶

In [1]:
import pandas as pd

# Graphing module imports
import plotly.graph_objects as go
import plotly.express as px
import plotly.io as pio
pio.renderers.default='notebook'
from plotly.subplots import make_subplots
In [2]:
df1 = pd.read_csv('data/powermeter.txt', header=None, parse_dates = [1], sep = '\t', names = ['power', 'time'])

Power measurement from circuit¶

In [3]:
df1
Out[3]:
power time
0 54.998126 2023-04-03 18:40:22.716
1 20.425514 2023-04-03 18:40:22.826
2 21.746616 2023-04-03 18:40:23.662
3 45.997079 2023-04-03 18:40:23.762
4 45.315621 2023-04-03 18:40:23.864
... ... ...
1579 115.849566 2023-04-03 18:43:03.711
1580 96.857369 2023-04-03 18:43:03.812
1581 106.921795 2023-04-03 18:43:03.913
1582 87.638194 2023-04-03 18:43:04.015
1583 106.978609 2023-04-03 18:43:04.115

1584 rows × 2 columns

In [4]:
with open('data/smipower.txt') as f:
    data = f.readlines()
    
data = [eval(x.strip()) for x in data]
data = [{'power': x['Power'].strip(), 'time': x['Time']} for x in data]
df2 = pd.DataFrame(data)
df2['time'] = pd.to_datetime(df2['time'])
df2['power'] = pd.to_numeric(df2['power'])

Power measurement from nvidia-smi¶

In [5]:
df2
Out[5]:
power time
0 27.03 2023-04-03 18:40:20.499
1 27.03 2023-04-03 18:40:20.648
2 27.03 2023-04-03 18:40:20.766
3 27.03 2023-04-03 18:40:20.886
4 27.03 2023-04-03 18:40:21.007
... ... ...
1126 161.24 2023-04-03 18:43:03.615
1127 149.25 2023-04-03 18:43:03.755
1128 128.49 2023-04-03 18:43:03.899
1129 118.46 2023-04-03 18:43:04.039
1130 137.32 2023-04-03 18:43:04.186

1131 rows × 2 columns

In [6]:
fig = make_subplots(rows=2, cols=1)
fig.add_trace(go.Scatter(x=df1['time'], y=df1['power'], mode='lines'), row=1, col=1)
fig.add_trace(go.Scatter(x=df1['time'], y=df1['power'], mode='markers'), row=2, col=1)
#fig.update_xaxes(rangeslider_visible=True)
fig.show()
In [7]:
fig = make_subplots(rows=2, cols=1)
fig.add_trace(go.Scatter(x=df2['time'], y=df2['power'], mode='lines'), row=1, col=1)
#fig.add_trace(go.Scatter(x=df1['time'], y=df1['power'], mode='lines'), row=2, col=1)
fig.update_xaxes(rangeslider_visible=True)
fig.show()

Combined power measurements from both sources¶

In [8]:
pieces = {'meter': df1, 'smi': df2}
df_concate = pd.concat(pieces, names=['source'])
df_concate = df_concate.reset_index(level=0)
df_concate
Out[8]:
source power time
0 meter 54.998126 2023-04-03 18:40:22.716
1 meter 20.425514 2023-04-03 18:40:22.826
2 meter 21.746616 2023-04-03 18:40:23.662
3 meter 45.997079 2023-04-03 18:40:23.762
4 meter 45.315621 2023-04-03 18:40:23.864
... ... ... ...
1126 smi 161.240000 2023-04-03 18:43:03.615
1127 smi 149.250000 2023-04-03 18:43:03.755
1128 smi 128.490000 2023-04-03 18:43:03.899
1129 smi 118.460000 2023-04-03 18:43:04.039
1130 smi 137.320000 2023-04-03 18:43:04.186

2715 rows × 3 columns

In [9]:
# A plot comparing SMI and meter measurements directly
# An interesting figure if SMI output and meter readings captured together

fig = px.scatter(df_concate, x='time', y='power', color='source',
                 title="Plotting power readings from both measurement setup and SMI sources")
fig.update_xaxes(rangeslider_visible=True)
fig.show()